package com.zst.service.with.amqp;

import com.zst.amqp.MessageSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class Application {
    @Autowired
    MessageSender messageSender;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @RequestMapping("/sendMessage")
    public String sendMessage(@RequestParam("content") String content, @RequestParam("type") String type){
        messageSender.send(content, type, Long.toString(System.currentTimeMillis()), "type01");
        return "success";
    }
}
